package com.tm.chargecar.controller;

import com.tm.chargecar.dto.BusinessDto;
import com.tm.chargecar.entity.BusinessEntity;
import com.tm.chargecar.entity.BzBsEntity;
import com.tm.chargecar.result.Result;
import com.tm.chargecar.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author wangSang
 * @create 2022-08-25 9:58
 *
 *  商家余额
 */
@RestController
@RequestMapping("business")
public class BusinessController {

    @Autowired
    private BusinessService businessService;

    /**
     *  查询对应的商家余额
     * @return
     */
    @GetMapping("queryBusiness/{bsUser}")
    public Result  queryBusiness(@PathVariable Long bsUser){


        return businessService.queryBusiness(bsUser);
    }

    /**
     *  商家提现
     * @return
     */

    @PutMapping("updateBusiness")
    public Result updateBusiness(@RequestBody BusinessDto  bsUser){


        return businessService.updateBusiness(bsUser);

    }



    /**
     *  新增中间表
     * @return
     */
    public Result addBusiness(BzBsEntity bsUser){


        return businessService.addBusiness(bsUser);

    }

    /**
     * 新增余额
     */

    public Result putBalance(BusinessDto businessDto){


        return businessService.putBalance(businessDto);

    }



}
